package com.qf.blog.controller;

import com.qf.blog.commons.response.ResponseResult;
import com.qf.blog.dto.PostDTO;
import com.qf.blog.service.ISysPostService;
import com.qf.blog.vo.PostVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping ("/sys/post")
@Slf4j
public class SysPostController {
    @Autowired
    private ISysPostService postService;

    @GetMapping
    public List<PostDTO> list() {
        return postService.queryAll();
    }

    @PostMapping
    public ResponseResult update(@RequestBody PostVo post) {
        postService.updateById(post);
        return ResponseResult.success();
    }
}
